package com.egao.orderB.controller;

import com.egao.common.core.annotation.ApiPageParam;
import com.egao.common.core.annotation.OperLog;
import com.egao.common.core.damon.results.PageResult2;
import com.egao.common.core.web.BaseController;
import com.egao.common.core.web.JsonResult;
import com.egao.orderB.entity.OceanTemplateFee;
import com.egao.orderB.service.OceanTemplateFeeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 *
 * 海运费用模板费用
 * @author : Doman
 * @date : 2021-10-19 15:39:59
 * @version ：1.0
 */

@Api(tags = "海运费用模板费用")
@RestController
@RequestMapping("/api/orderB/oceanTemplateFee")
public class OceanTemplateFeeController extends BaseController {

	@Autowired
	private OceanTemplateFeeService oceanTemplateFeeService;

	/**
	 * 分页查询列表
	 */
//	@PreAuthorize("hasAuthority('orderB:oceanTemplateFee:list')")
  @ApiOperation(value ="分页查询海运费用模板费用",notes = "" +
    "limit:每页显示几行 必填\n" +
    "page:第几页 必填\n" +
    "oceanTemplateId:费用模板Id\n" +
    " \n\n\n" +
    "返回的结果:\n" +
    "id:id\n" +
    "oceanTemplateId:费用模板Id\n" +
    "feeName:费用名称\n" +
    "price:金额\n" +
    "createTime:创建时间\n" +
    "createUser:创建人\n" +
    "updateTime:更新时间\n" +
    "updateUser:更新人\n" +
    "",httpMethod = "POST")
  @ApiPageParam
  @PostMapping("/list")
  public JsonResult page(PageResult2<T> page, OceanTemplateFee oceanTemplateFee) throws Exception{
    return oceanTemplateFeeService.list(page, oceanTemplateFee, getLoginUser());
  }

  /**
   * 查询全部海运费用模板费用
   */
//  @PreAuthorize("hasAuthority('orderB:oceanTemplateFee:list')")
  @ApiOperation("查询全部海运费用模板费用")
  @PostMapping("/listAll")
  public JsonResult list(OceanTemplateFee oceanTemplateFee){
    return oceanTemplateFeeService.list(oceanTemplateFee, getLoginUser());
  }

  /**
   * 根据id查询海运费用模板费用
   */
//  @PreAuthorize("hasAuthority('orderB:oceanTemplateFee:list')")
  @ApiOperation("根据id查询海运费用模板费用")
  @PostMapping("/get")
  public JsonResult get(OceanTemplateFee oceanTemplateFee) {
    return oceanTemplateFeeService.getById(oceanTemplateFee);
  }


  /**
   * 添加海运费用模板费用
   */
//  @PreAuthorize("hasAuthority('orderB:oceanTemplateFee:save')")
  @OperLog(value = "海运费用模板费用", desc = "添加", param = false, result = true)
  @ApiOperation(value ="添加海运费用模板费用",notes = "" +
    "oceanTemplateId:费用模板Id\n" +
    "feeName:费用名称\n" +
    "price:金额\n" +
    "",httpMethod = "POST")
  @PostMapping("/save")
  public JsonResult save(Model model, OceanTemplateFee oceanTemplateFee) {
    return oceanTemplateFeeService.save(oceanTemplateFee, getLoginUser());
  }

  /**
   * 修改海运费用模板费用
   */
//  @PreAuthorize("hasAuthority('orderB:oceanTemplateFee:update')")
  @OperLog(value = "海运费用模板费用", desc = "修改", param = false, result = true)
  @ApiOperation(value ="修改海运费用模板费用",notes = "" +
    "id:id\n" +
    "feeName:费用名称\n" +
    "price:金额\n" +
    "",httpMethod = "POST")
  @PostMapping("/update")
  public JsonResult update(Model model, OceanTemplateFee oceanTemplateFee) {
    return oceanTemplateFeeService.update(oceanTemplateFee, getLoginUser());
  }

  /**
   * 删除海运费用模板费用
   */
//  @PreAuthorize("hasAuthority('orderB:oceanTemplateFee:remove')")
  @OperLog(value = "海运费用模板费用", desc = "删除", result = true)
  @ApiOperation("删除海运费用模板费用")
  @PostMapping("/remove")
  public JsonResult remove(OceanTemplateFee oceanTemplateFee ) {
    return oceanTemplateFeeService.remove(oceanTemplateFee, getLoginUser());
  }

}
